#include <unordered_map>
#include <vector>
#include <string>

using namespace std;

class Solution
{
public:
    vector<string> uncommonFromSentences(string s1, string s2)
    {
        vector<string> ret;
        unordered_map<string, int> m;
        auto slow = s1.begin();
        auto fast = slow + 1;
        while (fast != s1.end())
        {
            if (*fast == ' ')
            {
                string tmp(slow, fast);
                ++m[tmp];
                slow = fast + 1;
            }
            ++fast;
        }
        string tmp1(slow, fast);
        ++m[tmp1];
        slow = s2.begin();
        fast = slow + 1;
        while (fast != s2.end())
        {
            if (*fast == ' ')
            {
                string tmp(slow, fast);
                ++m[tmp];
                slow = fast + 1;
            }
            ++fast;
        }
        string tmp2(slow, fast);
        ++m[tmp2];
        for (auto e : m)
        {
            if (e.second == 1)
            {
                ret.push_back(e.first);
            }
        }
        return ret;
    }
};